package com.dd.cloud.user.entity.role;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author zk
 */
@Data
@EqualsAndHashCode
@Accessors(chain = true)
@Table(comment = "角色菜单表")
public class RoleMenu {

    @TableId(value = "id", type = IdType.AUTO)
    @Column(isKey = true, isAutoIncrement = true)
    private Integer id;

    /**
     * 父菜单id
     */
    @Column(comment = "父菜单id")
    private Integer pid;

    /**
     * 类型
     */
    @Column(type = MySqlTypeConstant.TINYINT, comment = "类型")
    private Integer type;

    /**
     * 菜单类型 1菜单 2操作权限
     */
    @Column(type = MySqlTypeConstant.TINYINT, comment = "菜单类型 1菜单 2操作权限", isNull = false)
    private Integer menuType;

    /**
     * 操作类型
     */
    @Column(type = MySqlTypeConstant.TINYINT, comment = "操作类型", isNull = false)
    private Integer operateType;

    /**
     * 菜单名称
     */
    @Column(length = 20, comment = "菜单名称", isNull = false)
    private String title;

    /**
     * 菜单图标
     */
    @Column(length = 200, comment = "菜单图标")
    private String icon;

    /**
     * 菜单url资源
     */
    @Column(length = 200, comment = "菜单url资源")
    private String url;

    /**
     * 菜单排序
     */
    @Column(comment = "菜单排序")
    private Integer sort;

    /**
     * 菜单状态 1正常 -1删除
     */
    @Column(type = MySqlTypeConstant.TINYINT, comment = "菜单状态 1正常 -1删除")
    private Integer status;

    /**
     * 创建时间
     */
    @Column(comment = "创建时间", defaultValue = "now()")
    private LocalDateTime createDate;

    /**
     * 子菜单列表
     */
    @TableField(exist = false)
    private List<RoleMenu> sonMenus;
}
